In camera imaging, multiple factors, such as the size of the lens aperture, may influence the depth of field of an image. Large digital single-lens reflex (DSLR) cameras and cameras having wide aperture lenses can be used to capture images with a relatively shallow depth of field (SDOF), meaning that the range of scene depths for which objects in the captured image will appear sharp (i.e., in focus) is very small compared to images captured under other conditions (e.g., a narrower aperture). While the limited range of in-focus regions of a SDOF image may seem to be a physical limitation, it has been turned into an aesthetic advantage by photographers for over a century. For example, so-called SDOF photography may be particularly fit for portrait photography, since it emphasizes the subject (who is typically brought into the camera's focus range), while deemphasizing the background (e.g., by making the background appear blurry and/or out of focus), which may otherwise be of little interest in the scene.
In some instances, such as small form factor cameras used in mobile devices, it may be difficult to optically achieve a given level of SDOF. For example, a mobile phone camera may have a smaller aperture than the smallest aperture used by a DSLR camera, and thus may have a relatively large depth of field compared to what may be achieved by a DSLR camera. In these instances, to achieve an image having a shallower depth of field, it may be necessary to artificially introduce/simulate an out-of-focus blur in the image after it is captured.
Synthetically creating a natural-looking SDOF effect may be difficult. In particular, background light sources in such SDOF images may appear as large, blurred colored discs in the image, while the other background portions of the scene will simply appear blurry and out of focus, i.e., as compared to a foreground object in the scene that is close to the focus plane of the image, and thus appears sharp. Thus, the boundaries between foreground and background objects in an SDOF image may represent abrupt transitions from sharp pixels to blurry pixels, and any inaccuracies in rendering these boundaries (e.g., in the form of blurry background pixels ‘bleeding’ into a foreground object that should appear sharp, or vice versa) may result in images that look physically inaccurate or unnatural to a viewer.
Additionally, attempting to simulate this kind of out-of-focus blur may require a large amount of computational resources. For example, a naïve approach may attempt to simulate the SDOF effects by spreading every pixel in the image's light intensity onto every other pixel in the image that is within its blurring radius, adding all those values in an accumulator, and then repeating that spreading and accumulation process for every pixel in the image that needs to be blurred. Such approaches also may require meticulous user intervention and fine tuning to adjust the resulting image to have an acceptable synthetic SDOF effect, e.g., with minimal physically-inaccurate occlusions, mischaracterizations of foreground pixels as background pixels (or vice versa), etc.
The advent of mobile, multifunction devices, such as smartphones and tablet devices, has resulted in a desire for high-resolution, high dynamic range, and small form factor cameras, capable of generating high levels of image quality in real time or near-real time, for integration into such mobile, multifunction devices. Increasingly, as users rely on these multifunction devices as their primary cameras for day-to-day use, users demand features, e.g., portrait photography, which they have become accustomed to using in dedicated-purpose camera bodies. Thus, what is needed are techniques to synthesize SDOF effects, e.g., out-of-focus background renderings, in a computationally-efficient manner that reduces overall processing time. Such techniques may be applied to images to create the effect of a shallower depth of field than would normally be seen in images naturally captured by a device's camera system.